package com.nothing.thread.other;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchTest {

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(2);

        new Thread(){{
            System.out.println("-------------1");
            Thread.sleep(1000L);
            countDownLatch.countDown();
        }}.start();
        new Thread(){{
            System.out.println("------------2");
            Thread.sleep(1000L);
            countDownLatch.countDown();
        }}.start();
        countDownLatch.await();
    }
}
